        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>BaseMatcher abstract class / matcher Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="../styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="../favicon.ico">
        
        </head>
        <body data-library="matcher" data-type="BaseMatcher">
        <div class="page">
        <div class="header">
          <a href="../index.html"><div class="logo"></div></a>
          <a href="../index.html">Dart Documentation</a>
         &rsaquo; <a href="../matcher.html">matcher</a> &rsaquo; <a href="../matcher/BaseMatcher.html">BaseMatcher</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
        <h2><strong>BaseMatcher</strong>
          abstract class
        </h2>
        
<button id="show-inherited" class="show-inherited">Hide inherited</button>
<div class="doc">
<p>BaseMatcher is the base class for all matchers. To implement a new
matcher, either add a class that implements Matcher or a class that
extends BaseMatcher. Extending BaseMatcher has the benefit that a
default implementation of describeMismatch will be provided.</p>
<pre class="source">
abstract class BaseMatcher implements Matcher {
 const BaseMatcher();

 /**
  * Tests the matcher against a given [item]
  * and return true if the match succeeds; false otherwise.
  * [matchState] may be used to return additional info for
  * the use of [describeMismatch].
  */
 bool matches(item, MatchState matchState);

 /**
  * Creates a textual description of a matcher,
  * by appending to [mismatchDescription].
  */
 Description describe(Description mismatchDescription);

 /**
  * Generates a description of the matcher failed for a particular
  * [item], by appending the description to [mismatchDescription].
  * It does not check whether the [item] fails the match, as it is
  * only called after a failed match. There may be additional info
  * about the mismatch in [matchState].
  */
 Description describeMismatch(item, Description mismatchDescription,
                              MatchState matchState, bool verbose) =&gt;
   mismatchDescription.add('was ').addDescriptionOf(item);
}
</pre>
</div>
<h3>Subclasses</h3>
<p>
<span class="type-box"><span class="icon-class"></span><a href="../matcher/CustomMatcher.html">CustomMatcher</a></span>, <span class="type-box"><span class="icon-class"></span><a href="../matcher/Throws.html">Throws</a></span>, <span class="type-box"><span class="icon-class"></span><a href="../matcher/TypeMatcher.html">TypeMatcher</a></span>, <span class="type-box"><span class="icon-class"></span><a href="../matcher/isInstanceOf.html">isInstanceOf&lt;T&gt;</a></span></p>
<h3>Implements</h3>
<p>
<span class="type-box"><span class="icon-class"></span><a href="../matcher/Matcher.html">Matcher</a></span></p>
<div>
<h3>Constructors</h3>
<div class="method"><h4 id="BaseMatcher">
<button class="show-code">Code</button>
const <strong>BaseMatcher</strong>() <a class="anchor-link" href="#BaseMatcher"
              title="Permalink to BaseMatcher.BaseMatcher">#</a></h4>
<div class="doc">
<pre class="source">
const BaseMatcher();
</pre>
</div>
</div>
</div>
<div>
<h3>Methods</h3>
<div class="method"><h4 id="describe">
abstract <a href="../matcher/Description.html">Description</a> <strong>describe</strong>(<a href="../matcher/Description.html">Description</a> mismatchDescription) <a class="anchor-link" href="#describe"
              title="Permalink to BaseMatcher.describe">#</a></h4>
<div class="doc">
<p>Creates a textual description of a matcher,
by appending to 
<span class="param">mismatchDescription</span>.</p>
</div>
</div>
<div class="method"><h4 id="describeMismatch">
<button class="show-code">Code</button>
<a href="../matcher/Description.html">Description</a> <strong>describeMismatch</strong>(item, <a href="../matcher/Description.html">Description</a> mismatchDescription, <a href="../matcher/MatchState.html">MatchState</a> matchState, bool verbose) <a class="anchor-link" href="#describeMismatch"
              title="Permalink to BaseMatcher.describeMismatch">#</a></h4>
<div class="doc">
<p>Generates a description of the matcher failed for a particular

<span class="param">item</span>, by appending the description to 
<span class="param">mismatchDescription</span>.
It does not check whether the 
<span class="param">item</span> fails the match, as it is
only called after a failed match. There may be additional info
about the mismatch in 
<span class="param">matchState</span>.</p>
<pre class="source">
Description describeMismatch(item, Description mismatchDescription,
                            MatchState matchState, bool verbose) =&gt;
 mismatchDescription.add('was ').addDescriptionOf(item);
</pre>
</div>
</div>
<div class="method"><h4 id="matches">
abstract bool <strong>matches</strong>(item, <a href="../matcher/MatchState.html">MatchState</a> matchState) <a class="anchor-link" href="#matches"
              title="Permalink to BaseMatcher.matches">#</a></h4>
<div class="doc">
<p>Tests the matcher against a given 
<span class="param">item</span>
and return true if the match succeeds; false otherwise.

<span class="param">matchState</span> may be used to return additional info for
the use of <a class="crossref" href="../matcher/BaseMatcher.html#describeMismatch">describeMismatch</a>.</p>
</div>
</div>
</div>
        </div>
        <div class="clear"></div>
        </div>
        <div class="footer">
          
        </div>
        <script async src="../client-live-nav.js"></script>
        </body></html>
        
